<?php

	include("../inc/joomlaInt_admin.php");
	
	include("../inc/inc_lt.php");
	
	include("../inc/inc_configuration.php");
	
if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{
	
	$q="SELECT gid FROM $tbl_users WHERE id=$jUser";
					$qe=mysql_query($q);
					$qeo=mysql_fetch_object($qe);
					
					$gid=$qeo->gid;
					
					if ($gid!=$admingroup)
					{
						echo "Du bist kein Admin!";
						break;
					}
					
	$name=$_POST["name"];
	$teamAnz=$_POST["teamAnz"];
	$type=$_POST["type"];
	$pic=$_POST["pic"];
	
	//echo"name:$name - anz:$teamAnz";
	
	// $q="SELECT * FROM $tbl_season WHERE active=1";
	// $qe=mysql_query($q);
	
	// $qeo=mysql_fetch_object($qe);
	
	$season=$_SESSION["season"];
	
	$q = "INSERT INTO $tbl_leagues (name,land,seasonId,type,picId) VALUES (";
	$q.="'$name',1,$season,$type,$pic)";
	$qe=mysql_query($q);
	
	//echo "Ligaq:$q";
	
	$q="SELECT * FROM $tbl_leagues ORDER BY id DESC";
	$qe=mysql_query($q);
	
	$qeo=mysql_fetch_object($qe);
	
	$league=$qeo->id;
	
	//echo "<br><br>LigaqI:$q";
	
	
	
	$count=1;
		for($count = 1; $count <= $teamAnz; $count++)
				{
					$ps="team$count";
					$tP=$_POST[$ps];
					$anlegen=lt_anlegen($league,$tP);
					//echo"$anlegen";
				}
	
	
	echo'Sie werden weitergeleitet... <meta http-equiv="refresh" content="0; URL=../lima.php">';
	
}
	
	

?>